package pl.edu.agh.intobl;

import java.io.File;

import pl.edu.agh.intobl.utils.InputParser;


public class Main {

	/**
	 * @param args path to input file
	 */
	public static void main(String[] args) {
		if (args.length != 1) {
			usage();
			return;
		}
		
		File file = new File(args[0]);
		if (!file.exists() || file.isDirectory()) {
			usage();
			return;
		}
		
		InputParser parser = null;
		try {
			parser = new InputParser(file);
		} catch (Exception e) {
			System.out.println("Sorry an exception occured:\n " + e.getMessage());
			e.printStackTrace();
			return;
		}
		
		ProblemSolver.start(parser);
	}

	private static void usage() {
		System.out.println("You need to specify a path to file with input data\n" +
				"Example usage:\n" +
				"java Main C:/input.txt");
	}
}
